package com.ellricky.baselib.adapter;

import android.app.Activity;

import com.andr.common.ui.adapter.BaseRecyclerAdapter;
import com.andr.common.ui.adapter.SmartViewHolder;
import com.andr.common.util.EmptyUtil;
import com.ellricky.baselib.R;
import com.ellricky.baselib.util.GlideUtil;
import com.flyco.roundview.RoundFrameLayout;
import com.makeramen.roundedimageview.RoundedImageView;

import static android.view.View.GONE;
import static android.view.View.VISIBLE;

public class WorkUploadAdapter extends BaseRecyclerAdapter<String> {

    private Activity mContext;

    public WorkUploadAdapter(Activity activity) {
        super(R.layout.base_adapter_work_upload);
        mContext = activity;
    }


    @Override
    public void onBindViewHolder(SmartViewHolder holder, String model, final int position) {

        RoundFrameLayout addView = holder.itemView.findViewById(R.id.add_view);
        RoundedImageView ivPic = holder.itemView.findViewById(R.id.iv_pic);

        if (EmptyUtil.isEmpty(model)) {
            addView.setVisibility(VISIBLE);
            ivPic.setVisibility(GONE);
        } else {
            addView.setVisibility(GONE);
            ivPic.setVisibility(VISIBLE);
            GlideUtil.into(mContext, model, ivPic);
        }


    }


}
